package math

import "jvmgo/ch05/instructions/base"
import "jvmgo/ch05/rtda"

// negate double
type DNEG struct{
	base.NoOperandsInstruction
}
func (self *DNEG)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	val := stack.PopDouble()
	stack.PushDouble(-val)
}
//negate float
type FNEG struct{
	base.NoOperandsInstruction
}

func (self *FNEG)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	val := stack.PopFloat()
	stack.PushFloat(-val)
}
//negate int
type INEG struct{
	base.NoOperandsInstruction
}
func (self *INEG)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	val := stack.PopInt()
	stack.PushInt(-val)
}
// negate long
type LNEG struct{
	base.NoOperandsInstruction
}
func (self *LNEG)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	val := stack.PopLong()
	stack.PushLong(-val)
}